package com.qiwx.pigeon.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.CheckBox;
import android.widget.LinearLayout;

import androidx.annotation.Nullable;

import com.qiwx.pigeon.R;
import com.qiwx.pigeon.data.params.FertilizeParam;
import com.qiwx.pigeon.data.vo.CageRepairBean;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * @description
 * @Author qiwx
 * @Date 2020-06-10 17:25
 * 鸽笼维修
 **/
public class CageRepairOptionView extends LinearLayout {
    @BindView(R.id.cb_repair_sb)
    CheckBox cbRepairSb;
    @BindView(R.id.cb_repair_lw)
    CheckBox cbRepairLw;
    @BindView(R.id.cb_repair_wb)
    CheckBox cbRepairWb;
    @BindView(R.id.cb_repair_jg)
    CheckBox cbRepairJg;

    public CageRepairOptionView(Context context) {
        this(context, null);
    }

    public CageRepairOptionView(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public CageRepairOptionView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView(context);
    }

    private void initView(Context context) {
        LayoutInflater mInflater = LayoutInflater.from(context);
        View view = mInflater.inflate(R.layout.cage_repair_option, null);
        ButterKnife.bind(this, view);
        addView(view);

    }


    public CageRepairBean getParam() {
        CageRepairBean param = new CageRepairBean();
        param.setIs_wather_cup(cbRepairSb.isChecked() ? 1 : 0);
        param.setIs_cage_repair(cbRepairLw.isChecked() ? 1 : 0);
        param.setIs_fasten(cbRepairJg.isChecked() ? 1 : 0);
        param.setIs_need_hwb(cbRepairWb.isChecked() ? 1 : 0);
        return param;

    }


    //重置选项
    public void resetOptions() {
        cbRepairSb.setChecked(false);
        cbRepairLw.setChecked(false);
        cbRepairWb.setChecked(false);
        cbRepairJg.setChecked(false);
    }
}
